package com.BMS.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.BMS.DAOImpl.ViolationDaoImpl;
import com.BMS.Service.ViolationService;
import com.BMS.entity.Violation;

/**
 * 违规记录实体类业务层接口实现类
 * @author lenovo
 *
 */
@Transactional
@Service("ViolationService")
public class ViolationServiceImpl implements ViolationService {

	@Autowired
	public ViolationDaoImpl violationDao;
	
	@Override
	public void addViolation(Violation violation) {
		violationDao.addViolation(violation);
	}

	@Override
	public void deleteViolationById(int violation_id) {
		violationDao.deleteViolationById(violation_id);
	}

	@Override
	public Violation findViolationById(int violation_id) {
		return violationDao.findViolationById(violation_id);
	}

	@Override
	public List<Violation> findViolationsByReaderId(String reader_id) {
		return violationDao.findViolationsByReaderId(reader_id);
	}
	
	// 分页查询图书，并按指定字段排序
	@Override
	public List<Violation> findAllViolations(int offset, int length, String orderBy) {
		return violationDao.findAllViolations(offset, length, orderBy);
	}

	// 显示分页总页数
	@Override
	public long getPageCount() {
		return violationDao.getPageCount();
	}
	
	@Override
	public void updateViolation(Violation violation) {
		violationDao.updateViolation(violation);
	}

}
